<template>
    <div>
        <h2>{{tehuilist.title}}</h2>
        <ul>
            <li v-for="data in tehuilist.list" :key="data.id" @click="hankdetail(data.id)">
                <img :src="data.img" alt="">
                <div class="cen">
                    <div>{{data.label}}</div>
                    <div>{{data.name}}</div>
                    <div>{{data.desc}}</div>
                    <div>￥ {{data.price}}</div>
                </div>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
  props: {
    tehuilist: {
      type: Object
    }
  },
  methods: {
    hankdetail (id) {
      if (id.includes('jd')) {
        this.$router.push({ path: '/pages/jd-union/list/detail', query: { id: id } })
        return
      }
      this.$router.push({ path: '/pages/detail/detail', query: { id: id } })
    }
  }
}
</script>
<style lang="scss" scoped>
    h2{
        font-size: 18px;
        margin: 28px 0 18px 0;
        }
    ul{
        display: flex;
        flex-wrap: wrap;
        li{
            width: 48%;
            margin-right:10px;
            margin-bottom: 10px;
            background: #fff;
            img{
                width: 172px;
                height: 172px;
            }
        }
    }
    ul li:nth-of-type(even){
        margin-right: 0;
    }
    .cen{
        text-align: center;
        padding: 10px;
        position: relative;
        div{
            width: 100%;
            overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;

        }
        div:nth-of-type(even){
            font-size: 14px;
            color: #262626;
        }
        div:nth-of-type(odd){
            font-size: 12px;
            color: #8c8c8c;
        }
    }
    .cen div:nth-last-of-type(1){
        color: #ea413c;
    }
    .cen div:nth-of-type(1){
        background: #ea413c;
        position: absolute;
        color: #fff;
        left: 50%;
        transform: translate(-50%,0);
        top: -20px;
    }
</style>
